﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Skynet.WebFoundation.Controls.Design
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:BoolAlternativeControl runat=server></{0}:BoolAlternativeControl>")]
    public class BoolAlternativeControl : CompositeControl
    {        
        public bool Answer
        {
            get
            {
                return this._yb.Checked;                
            }
            set
            {
                if (value)
                {
                    this._yb.Checked = true;
                    this._nb.Checked = false;
                }
                else
                {
                    this._yb.Checked = false;
                    this._nb.Checked = true;
                }
                
            }
        }
        private RadioButton _yb = new RadioButton() { GroupName="YesNoGroup" , Text="yes"};
        private RadioButton _nb = new RadioButton() { GroupName="YesNoGroup" , Text="no"};
        protected override void CreateChildControls()
        {
            this._yb.SkinID = this.SkinID;            
            this._nb.SkinID = this.SkinID;
            this.Controls.Add(_yb);
            this.Controls.Add(_nb); 
        }   
    }
}
